package fifis.mvc.view;

import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import fifis.game.common.Common;
import fifis.mvc.model.FModel;
import org.apache.log4j.Logger;

/**
 *
 * @author porfiriopartida
 */
public abstract class FView {
    protected final static Logger log4j = Logger.getLogger(FView.class);
    public static final long serialVersionUID = 1L;
    FModel model;
    Node node;
    public FView(FModel model, Node node) {
        this.model = model;
        this.node = node;
    }
    public FView(FModel model, String path) {
        this.model = model;
        
        String name = model.getName();
        node = Common.getInstance().getNode(path, name, true);
        
        log4j.debug("Creating node : " + node.toString());
    }
    public FView(FModel model) {
        this(model, model.getName());
    }
    public void setNode(Node node) {
        this.node = node;
    }
    public Node getNode() {
        return node;
    }
    public void addChild(Spatial spatial) {
        node.attachChild(spatial);
    }
    public FModel getModel() {
        return model;
    }
}
